package com.lbt.staservice.schedule;

import com.lbt.staservice.service.StatisticsDailyService;
import com.lbt.staservice.untils.DateUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.util.Date;
//每天凌晨1点自动统计  注册人数
@Component
public class SheduledTask {

    @Autowired
    StatisticsDailyService statisticsDailyService;

    @Scheduled(cron = "0 0 1 * * ?")
    public void task1(){
        statisticsDailyService.registerCount(DateUtil.formatDate(DateUtil.addDays(new Date(),-1)));
    }
}
